import request from '@/utils/request'

// 查询商品列表
export function listProduct(query) {
  return request({
    url: '/module/product/list',
    method: 'get',
    params: query
  })
}


// 查询积分列表
export function listEstatePointsProduct(query) {
  return request({
    url: '/module/product/estatePointsList',
    method: 'get',
    params: query
  })
}

// 查询商品列表
export function listProductByMerId(id) {
  return request({
    url: '/module/product/listByMer/' + id,
    method: 'get'
  })
}


// 查询商品详细
export function getProduct(id) {
  return request({
    url: '/module/product/' + id,
    method: 'get'
  })
}


// 是否热销修改
export function handleIshotChange(id, isHot) {
  const data = {
    id,
    isHot
  };
  return request({
    url: '/module/product/handleIshotChange',
    method: 'put',
    data
  })
}


// 售罄状态
export function changeSaleOutStatus(id, isSaleOut) {
  const data = {
    id,
    isSaleOut
  };
  return request({
    url: '/module/product/changeSaleOutStatus',
    method: 'put',
    data
  })
}




// 重置二维码
export function resetQrCode(data) {
  return request({
    url: '/module/product/resetQrCode',
    method: 'post',
    data
  })
}
export function resetQrCode2(data) {
  return request({
    url: '/module/product/resetQrCode',
    method: 'post',
    data
  })
}
// 查询商品列表
export function goAddData(query) {
  return request({
    url: '/module/product/goAddData',
    method: 'get',
    params: query
  })
}

export function isFormatAttr(id, data,isReset) {
  return request({
    url: '/module/product/isFormatAttr/' + id + "/"+isReset,
    method: 'post',
    data
  })
}

// 新增商品
export function addProduct(data) {
  return request({
    url: '/module/product',
    method: 'post',
    data
  })
}

// 新增商品
export function addPointsProduct(data) {
  return request({
    url: '/module/product/addPointsProduct',
    method: 'post',
    data
  })
}

// 修改商品
export function updateProduct(data) {
  return request({
    url: '/module/product',
    method: 'put',
    data
  })
}

export function updateProductNum(data) {
  return request({
    url: '/module/product/num',
    method: 'put',
    data
  })
}

// 删除商品
export function delProduct2(id) {
  return request({
    url: '/module/product/remove2/' + id,
    method: 'delete'
  })
}

// 删除商品
export function delProduct(id) {
  return request({
    url: '/module/product/' + id,
    method: 'delete'
  })
}
// 导出商品
export function exportProduct(query) {
  return request({
    url: '/module/product/export',
    method: 'get',
    params: query
  })
}
export function showList(query) {
  return request({
    url: '/module/product/showList',
    method: 'get',
    params: query
  })
}
